export default {
  namespaced: true,  //命令空间会使得modules独立
  state: {
    username: 'chanqi',
    userAge: '18',
    num:0
  },
  mutations: {
    updateName(state, payload) {
      state.username = payload
    },
    increment(state) {
      state.num ++
    }
  },
  actions: {
    userActionsRoot({ commit, dispatch, state, rootState, getters, rootGetters }) {
      commit('increment', null, {root:true})
    },
    userActions({ commit, dispatch, state, rootState, getters, rootGetters }) {
      commit('increment', null)
    }
    //dispatch("incrementAction", null, {root:true})
  },
  getters: {
    userGetters(state, getters, rootState, rootGetters) {
      console.log(state, getters, rootState, rootGetters);
      return 1
    }
  }
}